package com.shmn.gongjiajumain.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.shmn.gongjiajumain.entity.OutgoIncomeHistoryEntity;
import com.shmn.gongjiajumain.service.OutgoIncomeHistoryService;
import com.shmn.common.utils.PageUtils;
import com.shmn.common.utils.R;



/**
 * 记录工夹具的历史出入库申请
 *
 * @author chenshun
 * @email 1005074582@qq.com
 * @date 2023-05-14 16:40:27
 */
@RestController
@RequestMapping("gongjiajumain/outgoincomehistory")
public class OutgoIncomeHistoryController {
    @Autowired
    private OutgoIncomeHistoryService outgoIncomeHistoryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("gongjiajumain:outgoincomehistory:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = outgoIncomeHistoryService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("gongjiajumain:outgoincomehistory:info")
    public R info(@PathVariable("id") Integer id){
		OutgoIncomeHistoryEntity outgoIncomeHistory = outgoIncomeHistoryService.getById(id);

        return R.ok().put("outgoIncomeHistory", outgoIncomeHistory);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("gongjiajumain:outgoincomehistory:save")
    public R save(@RequestBody OutgoIncomeHistoryEntity outgoIncomeHistory){
		outgoIncomeHistoryService.save(outgoIncomeHistory);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("gongjiajumain:outgoincomehistory:update")
    public R update(@RequestBody OutgoIncomeHistoryEntity outgoIncomeHistory){
		outgoIncomeHistoryService.updateById(outgoIncomeHistory);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("gongjiajumain:outgoincomehistory:delete")
    public R delete(@RequestBody Integer[] ids){
		outgoIncomeHistoryService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
